package com.learn.security.modules.security;

import com.learn.security.modules.vo.UserDto;
import me.chanjar.weixin.mp.bean.result.WxMpUser;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;

/**
 * created by yuanjunjie on 2019/6/10 3:37 PM
 */
public interface CustomUserDetailsService extends UserDetailsService {
    /**
     * 根据社交、手机号登录code 登录
     *
     * @param loginUserType 登录用户类型
     * @param user 登录用户数据
     * @return UserDetails
     * @throws UsernameNotFoundException
     */
    UserDetails loadUserBySocial(LoginUserType loginUserType, UserDto user) throws UsernameNotFoundException;

    /**
     * 根据微信openid登录
     * @param loginUserType
     * @param mpUser
     * @return
     * @throws UsernameNotFoundException
     */
    UserDetails loadUserByOpenId(LoginUserType loginUserType, WxMpUser mpUser) throws AuthenticationException;
}
